  program conv
  
   use constants
  
    implicit none
      integer :: i,j
      character(10) :: algo
      integer :: N_orb, N_atoms
      real(dp), allocatable :: r_atoms(:,:)
      integer, allocatable :: atom_number(:)
      character(len=2), allocatable :: atom_type(:)	    
      
      open(1,file='coords.xyz')
      open(2,file='coords_huck.xyz')		
      write(*,*)'converting coordinates ...'
      read(1,*)N_atoms
      read(1,*)
      write(*,*)'NumberOfAtoms',N_atoms
      allocate(atom_type(N_atoms))
      allocate(r_atoms(N_atoms,3))
      allocate(atom_number(N_atoms))
      
      r_atoms=0.0_dp
      
      do i=1,N_atoms
       read(1,*)atom_type(i),r_atoms(i,1),r_atoms(i,2),r_atoms(i,3)
      enddo
  
!      write(2,*)N_atoms
      write(2,*)''
   
      do i=1,N_atoms
      do j=1,NZ
       if(atom_type(i).EQ.name(j))atom_number(i)=j
      enddo
       write(2,'(I,3F10.5)')atom_number(i),r_atoms(i,1),r_atoms(i,2),r_atoms(i,3)    
      enddo

                 
      close(1)
      close(2)
      

    end 
    
